#ifndef DOKERMODEL_H
#define DOKERMODEL_H

#include <QObject>
#include <QHash>

QT_FORWARD_DECLARE_CLASS(QGraphicsScene)

class DokerModel : public QObject
{
    Q_OBJECT
public:
    enum DocumentType
    {
        UnknownType = 0,
        ProjectType = 1,    // *.dokp
        BundleType = 2      // *.dokz
    };
    explicit DokerModel(QObject *parent = 0);
    void create();
    bool load(const QString &fullFileName);
    bool save();
    void editRequest(const QString &fileName);
    QByteArray fileData(const QString &fileName);
    void setFileData(const QString &fileName, const QByteArray &data);
    bool contains(const QString &fileName);
    void setModified() { m_isModified = true; }
    bool isModified() { return m_isModified; }
    bool isUntitled() { return m_isUntitled; }

    void setFullFileName(const QString &fullFileName);
    QString fullFileName() { return m_fullFileName; }
    
signals:
    void fileAdded(const QString &dokzName, const QString &fileName);
    void textEditRequested(const QString &fileName);
    void modified(const QString &fileName, bool modified);
    
public slots:
private:
    DocumentType                 m_type;
    QString                      m_fullFileName;
    QHash<QString,QByteArray>    m_files;
    bool                         m_isModified;
    bool                         m_isUntitled;
};

#endif // DOKERMODEL_H
